<template>
	<view style="margin-bottom: 100rpx;">
		
			<uni-nav-bar title="订单已完成" backgroundColor="#f6f6f6" status-bar :fixed="true" :border="false">
				<block slot="left">
					<view style="display: flex;flex-direction: row;align-items: center;justify-content: flex-start;">
						<!-- <view @click="goBack" style="margin-left: 10px;">
							<uni-icons type="back" size="20" color="#666" />
						</view> -->
						<view @click="goHome" style="margin-left: 10px;">
							<uni-icons type="home" size="20" color="#666" />
						</view>
					</view>
				</block>
			</uni-nav-bar>
		
		<view style="display: flex;flex-direction: column;padding: 10px 10px 0px 10px;">
			<view style="background-color: #ffffff;border-radius: 5px;padding: 10px;display: flex;flex-direction: row;align-items: center;justify-content: center;">
				<image style="width: 25px;height: 25px;" src="../../static/images/paySuccess.png"></image>
				<view style="margin-left: 10px;font-size: 16px;font-weight: 600;color: #000000;">
					支付成功
				</view>
			</view>
		</view>
		
		<view style="display: flex;flex-direction: column;padding: 10px 10px 0px 10px;">
			<view style="background-color: #ffffff;border-radius: 5px;padding: 10px;display: flex;flex-direction: column;">
				
				<view style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;">
					<view style="font-size: 14px;color: #6E6E6E;">
						订单编号：
					</view>
					<view style="font-size: 14px;color: #6E6E6E;">
						{{orderNumber}}
					</view>
				</view>
				<view style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;margin-top: 10px;">
					<view style="font-size: 14px;color: #6E6E6E;">
						支付时间：
					</view>
					<view style="font-size: 14px;color: #6E6E6E;">
						{{payTime}}
					</view>
				</view>
				<view style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;margin-top: 10px;">
					<view style="font-size: 14px;color: #6E6E6E;">
						支付金额：
					</view>
					<view style="font-size: 14px;color: #6E6E6E;">
						{{orderMoney}}
					</view>
				</view>
				
				
			</view>
		</view>
		
	</view>
</template>

<script>
	import { getToken } from '@/utils/auth'
	
	export default {
		name:'paySuccess',
		onShow() {
			if(getToken()){
				wx.cloud.callContainer({
				  "config": {
				    "env": this.txCloudEnvID
				  },
				  "path": "/system/client/list?mobile="+getToken(),
				  "header": {
				    "X-WX-SERVICE": this.vxService,
				    "content-type": "application/json"
				  },
				  "method": "GET",
				  "data": ""
				}).then((res) =>{
					this.$store.dispatch('Logins', res.data.data[0]).then(() => {
					}).catch(() => {
					})
				}).catch((e) =>{
					console.log(e.message);
					if(e.message.indexOf('102002') !== -1){
						this.$modal.showToast('请求超时')
					}else{
						this.$modal.showToast(e.message)
					}
				})
			}
		},
		onLoad(option) {
			// 		orderMoney: "6594.00"
			// 		orderNumber: "YQTXCYIPEKCST2024083020061177221"
			// 		payTime: "2024-08-30 20:06:49"
			//UATOLVLLWGETX2024083020161235856 ___ 2024-08-30 20:16:31 ___ 3297.00
			console.log(option.orderNumber,'___',option.payTime,'___',option.orderMoney)
			this.orderNumber = option.orderNumber;
			this.payTime = option.payTime;
			this.orderMoney = option.orderMoney;
			
		},
		created() {
			
		},
		computed:{
		  userInfo() {
			return this.$store.state.user.userinfo
		  },
		  windowHeight() {
			return uni.getSystemInfoSync().windowHeight - 0
		  }
		},
		data() {
			return {
				txCloudEnvID:getApp().globalData.config.appInfo.txCloudEnvID,
				vxService:getApp().globalData.config.appInfo.vxService,
				orderNumber:'',
				payTime:'',
				orderMoney:'',
			}
		},
		methods: {
			
			
			goBack(){
				this.$tab.navigateBack();
			},
			goHome(){
				this.$tab.reLaunch("/pages/index");
			}
			
		}
	}
</script>

<style>

</style>
